<template>
	<view class="time">
		<!-- 头部 -->
		<view class="time_title">
			<image src="@/static/yy.jpg" mode=""></image>
		</view>
		<!-- 内容 -->
		<view class="time_data">
			<view class="time_list font13 flex-row-between" v-for="(item,index) in timeList" :key="index"
				@click="Onpay(item)">
				<view class="font-323232">{{item.time_begin_time}}~{{item.time_end_time}}</view>
				<view class="time_bos flex-row-start font-ef9140">
					<view>剩余可预约数:{{item.number}}</view>
					<image src="@/static/my/morea.png"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataobj: {
					physical_id: null,
					time: null,
					physical_user_id: null,
					time_begin_time: null,
					time_end_time: null
				},
				timeList: []
			}
		},
		onLoad: function(options) {
			this.dataobj.physical_id = options.id
			this.dataobj.time = options.time
			this.dataobj.physical_user_id = options.Uid
			//获取时间详情
			this.OnInfo()
		},
		methods: {
			//获取时间详情
			OnInfo() {
				this.$Http({
					url: 'physicalTime',
					data: {
						time: this.dataobj.time,
						physical_id: this.dataobj.physical_id
					}
				}).then(res => {
					if (res.code == 1) {
						this.timeList = res.data
					}
				})
			},
			//去支付
			Onpay(item) {
				this.dataobj.time_begin_time = item.time_begin_time
				this.dataobj.time_end_time = item.time_end_time
				this.$Http({
					url: 'physicalCreateOrder',
					data: this.dataobj,
					type:'POST',
					show:true
				}).then(res => {
					if (res.code == 1) {
						uni.navigateTo({
							url: '/pagesA/check/pay/pay?code='+res.data.order_code,
						})
					}
				})

			}
		}
	}
</script>

<style lang="less">
	@import url("time.less");
</style>
